package com.dji.common.utils;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window;

public class UIUtil{

	public static void setCenter(Component window){
		if(window!=null){
			Dimension dimension=Toolkit.getDefaultToolkit().getScreenSize();
			window.setBounds((int)(dimension.getWidth()-window.getWidth())/2,
					(int)(dimension.getHeight()-window.getHeight())/2,window.getWidth(),window.getHeight());
		}
	}

	public static void setFullScreen(Window window){
		if(window!=null){
			Dimension dimension=getScreenSize();
			window.setBounds(0,0,(int)dimension.getWidth()+10,(int)dimension.getHeight()+10);
		}
	}

	public static Dimension getScreenSize(){
		return Toolkit.getDefaultToolkit().getScreenSize();
	}

	public static String getProjectPath(){
		return UIUtil.class.getResource("/").getPath();
	}

}
